package com.example.photograph.service.impl;

import com.example.photograph.domain.SysOrder;
import com.example.photograph.mapper.SysOrderMapper;
import com.example.photograph.service.ISysOrderService;
import com.example.photograph.utils.Convert;
import com.example.photograph.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用户订单Service业务层处理
 * 
 * @author wuyj
 * @date 2021-03-06
 */
@Service
public class SysOrderServiceImpl implements ISysOrderService 
{
    @Autowired
    private SysOrderMapper sysOrderMapper;

    /**
     * 查询用户订单
     * 
     * @param orderId 用户订单ID
     * @return 用户订单
     */
    @Override
    public SysOrder selectSysOrderById(Long orderId)
    {
        return sysOrderMapper.selectSysOrderById(orderId);
    }

    /**
     * 查询用户订单列表
     * 
     * @param sysOrder 用户订单
     * @return 用户订单
     */
    @Override
    public List<SysOrder> selectSysOrderList(SysOrder sysOrder)
    {
        return sysOrderMapper.selectSysOrderList(sysOrder);
    }

    /**
     * 新增用户订单
     * 
     * @param sysOrder 用户订单
     * @return 结果
     */
    @Override
    public int insertSysOrder(SysOrder sysOrder)
    {
        sysOrder.setCreateTime(DateUtils.getNowDate());
        return sysOrderMapper.insertSysOrder(sysOrder);
    }

    /**
     * 修改用户订单
     * 
     * @param sysOrder 用户订单
     * @return 结果
     */
    @Override
    public int updateSysOrder(SysOrder sysOrder)
    {
        sysOrder.setUpdateTime(DateUtils.getNowDate());
        return sysOrderMapper.updateSysOrder(sysOrder);
    }

    /**
     * 删除用户订单对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteSysOrderByIds(String ids)
    {
        return sysOrderMapper.deleteSysOrderByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除用户订单信息
     * 
     * @param orderId 用户订单ID
     * @return 结果
     */
    @Override
    public int deleteSysOrderById(Long orderId)
    {
        return sysOrderMapper.deleteSysOrderById(orderId);
    }
}
